package com.apes.config.flyway;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.Ordered;

public class FlywayMigrationInitializer implements InitializingBean, Ordered {
    private final ApesFlywayMigrationStrategy migrationStrategy;

    public FlywayMigrationInitializer(ApesFlywayMigrationStrategy migrationStrategy) {
        this.migrationStrategy = migrationStrategy;
    }

    @Override
    public void afterPropertiesSet() {
        this.migrationStrategy.migrate();
    }

    @Override
    public int getOrder() {
        return Integer.MAX_VALUE;
    }
}
